/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1575692165812_8460';

  config.wechatConfig = {
    appID: 'wx9af99ce6860c504a',
    appSecret: 'e7061f8e1d7650ca00a2ea756006bfd9',
    token: 'xiaowengge'
  }
  // add your middleware config here
  config.middleware = [];
  //配置views视图模板
  config.view = {
    defaultViewEngine: 'nunjucks',
    mapping: {
      '.html': 'nunjucks' //左边写成.html后缀，会自动渲染.html文件
    },
  }

  config.mongoose = {

    url: 'mongodb://127.0.0.1:27017/eggapi', // 你的数据库地址，不要端口
    options: {
      useNewUrlParser: true,
    },
  };

  config.security = {
    csrf: {
      enable: false,
      ignoreJSON: true
    },
    domainWhiteList: ['http://localhost:8080', 'http://localhost:7001']
  };

  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
  };


  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
